<template>
    <el-aside :width="$store.state.isCollapsed?'64px':'200px'">
        <el-menu :collapse="$store.state.isCollapsed" 
        :collapse-transition="false"
        :router="true"
        :default-active="route.fullPath">
            <el-menu-item index="/index">
                <el-icon><HomeFilled /></el-icon>
                <span>
                    首页
                </span>
            </el-menu-item>

            <el-menu-item index="/center">
                <el-icon>
                    <Avatar />
                </el-icon>
                <span>
                    个人中心
                </span>
            </el-menu-item>

            <!--子菜单-->
            <el-sub-menu index="/user-manage">
                <template #title>
                    <el-icon>
                        <UserFilled/>
                    </el-icon>
                    <span>用户管理</span>
                </template>
                    <el-menu-item index="/user-manage/useradd">
                        <el-icon><Plus /></el-icon>
                        添加用户
                    </el-menu-item>
                    <el-menu-item index="/user-manage/userlist">
                        <el-icon><Search /></el-icon>
                        用户列表
                    </el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="/news-manage">
                <template #title>
                    <el-icon>
                        <MessageBox />
                    </el-icon>
                    <span>物业新闻管理</span>
                </template>
                    <el-menu-item index="/news-manage/newsadd">
                        <el-icon><Plus /></el-icon>
                        添加新闻
                    </el-menu-item>
                    <el-menu-item index="/news-manage/newslist">
                        <el-icon><Search /></el-icon>
                        新闻列表
                    </el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="/work-manage">
                <template #title>
                    <el-icon>
                        <Reading />
                    </el-icon>
                    <span>物业工作展示管理</span>
                </template>
                    <el-menu-item index="/work-manage/workadd">
                        <el-icon><Plus /></el-icon>
                        添加工作展示
                    </el-menu-item>
                    <el-menu-item index="/work-manage/worklist">
                        <el-icon><Search /></el-icon>
                        工作展示列表
                    </el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="/proprietor-manage" v-admin>
                <template #title>
                    <el-icon>
                        <TakeawayBox />
                    </el-icon>
                    <span>业主管理</span>
                </template>
                    <el-menu-item index="/proprietor-manage/addproprietormsg">
                        <el-icon><Plus /></el-icon>
                        添加业主信息
                    </el-menu-item>
                    <el-menu-item index="/proprietor-manage/proprietormsg">
                        <el-icon><Search /></el-icon>
                        业主信息管理
                    </el-menu-item>
                    <el-menu-item index="/proprietor-manage/addaccount">
                        <el-icon><Plus /></el-icon>
                        添加业主账号
                    </el-menu-item>
                    <el-menu-item index="/proprietor-manage/accountlist">
                        <el-icon><Search /></el-icon>
                        业主账号管理
                    </el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="/propertycharges-manage">
            
                <template #title>
                    <el-icon>
                        <Money />
                    </el-icon>
                    <span>物业收费管理</span>
                </template>
                    <el-menu-item index="/propertycharges-manage/addexpense">
                        <el-icon><Plus /></el-icon>
                        月物业费用添加
                    </el-menu-item>
                    <el-menu-item index="/propertycharges-manage/expense">
                        <el-icon><Plus /></el-icon>
                        物业费用管理
                    </el-menu-item>
                    <el-menu-item index="/propertycharges-manage/notification">
                        <el-icon><Bell /></el-icon>
                        缴费通知提醒
                    </el-menu-item>
                    <el-menu-item index="/propertycharges-manage/search">
                        <el-icon><Search /></el-icon>
                        缴费记录查询
                        </el-menu-item>
                    <el-menu-item index="/propertycharges-manage/sheet">
                        <el-icon><Histogram /></el-icon>
                        报表统计分析
                    </el-menu-item>
            </el-sub-menu>
        </el-menu>
    </el-aside>
</template>

<script setup>
    import {HomeFilled,Avatar,UserFilled,MessageBox,Reading,Pointer,TakeawayBox,Money,Plus,Search,Bell,Histogram} from "@element-plus/icons-vue";
    import {useRoute} from 'vue-router' //获取路由路径
    import { useStore } from "vuex";
    const route = useRoute() // 传给上面的 实现高亮菜单


    const store = useStore()
    
    const vAdmin = {
        mounted(el) {
            // console.log(el.parentNode)
            if(store.state.userInfo.role!==1){
                // console.log("进来删除")
                el.parentNode.removeChild(el.parentNode.children[2])
                // el.parentNode.removeChild(el)
            }
        }
    }

</script>
<style lang="scss" scoped>
    .el-aside{
        height:100vh;
        .el-menu{
            height:100vh;
        }
    }

</style>